#include "stdafx.h"
#include "date.h"
#include <iostream>
using namespace std;

//class Date implementaion
Date::Date(unsigned year, unsigned month, unsigned day)
{
    this->year = year;
    this->month = month;
    this->day = day;
}

Date::Date(const Date& date)
{
    this->year = date.year;
    this->month = date.month;
    this->day = date.day;
}

Date& Date::operator = (const Date& date)
{
    this->year = date.getDateYear();
    this->month = date.getDateMonth();
    this->day = date.getDateDay();
	return *this;
}


void Date::setDate(const unsigned year, const unsigned month, const unsigned day)
{
    this->year = year;
    this->month = month;
    this->day = day;
}

unsigned Date::getDateYear() const
{
    return this->year;
}

unsigned Date::getDateMonth() const
{
    return this->month;
}

unsigned Date::getDateDay() const
{
    return this->day;
}

void Date::printDate() const
{
    int choice;
    do
    {
        cout << "Select Format:" << endl << "\t" << "1.YYYYMMDD" << endl << "\t" << "2.DDMMYYYY" << endl;
        cin >> choice;
    }
    while( (choice != 1) && (choice !=2) );

    switch(choice)
    {
        case 1: cout << this->year << "\t" << this->month << "\t" << this->day << endl;break;
        case 2: cout << this->day << "\t" << this->month << "\t" << this->year << endl;break;
    }
}

